<?php $this->widget('application.components.ConstraintMess'); ?>
<?php if($search):?>
<h2>查询车型信息</h2>
<?php else:?>
<h2>修改车型信息</h2>
<?php endif?>
<?php echo CHtml::beginForm(array($search?'search':'admin'),'post');?>
<table  style="margin: 0 auto;"  width="710">
<tr><td>
	车型：<input type="text" name="keys[type_name]" size="7" value="<?php echo isset($_GET['keys']['type_name'])?$_GET['keys']['type_name']:'';?>"/>
	模糊查询：<input type="radio" name="keys[blur]" value="1" checked/>是  
	<input type="radio" name="keys[blur]" value="0" <?php echo isset($_GET['keys']['blur'])&&$_GET['keys']['blur']==0?'checked':'';?>/>否
	<input type="submit" value="搜索"/>
</td></tr></table>
<?php echo CHtml::endForm();?>
<table class="dataGrid"  width="710">
  <thead>
  <tr>
    <th  width="150"><?php echo $sort->link('type_name'); ?></th>
    <th  width="110"><?php echo $sort->link('compute_ratio'); ?></th>
    <th  width="200"><?php echo $sort->link('remark'); ?></th>
    <th  width="150"><?php echo $sort->link('create_time'); ?></th>
	<?php if(!$search):?><th  width="100">操作</th><?php endif ?>
  </tr>
  </thead>
  <tbody>
<?php foreach($models as $n=>$model): ?>
  <tr class="<?php echo $n%2?'even':'odd';?>">
     <?php 
    	$url=array('show','id'=>$model->id)+$_GET;//把所有参数包括页码、查询参数传入显示信息页面
    	$url['ret']=$search?'search':'admin';
    ?>
    <td><?php echo CHtml::link($model->type_name,$url); ?></td>
    <td><?php echo CHtml::encode(($model->compute_ratio*100).'%'); ?></td>
    <td><?php echo CHtml::encode($model->remark); ?></td>
    <td><?php echo CHtml::encode($model->create_time); ?></td>
    <?php if(!$search):?>
    <td>
      <?php echo CHtml::link('修改',array('update','id'=>$model->id)+$_GET); ?>
     <?php echo CHtml::link('删除',array('delete','id'=>$model->id)+$_GET,array('confirm'=>"确定要删除 {$model->type_name}的车型信息吗？")); ?>
	</td>
	<?php endif ?>
  </tr>
<?php endforeach; ?>
  </tbody>
</table>
<br/>
<?php $this->widget('CLinkPager',array('pages'=>$pages,'htmlOptions'=>array('style'=>'width:710px;'))); ?>
